package stopwatch;
import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;

import utility.Constants;

final class Alarm extends TimerTask{

	private final Timer timer = new Timer();
	private int duration;
	
	void set(final int min){
		duration = min*Constants.MILLIS_MIN;
		timer.schedule(this, duration);
	}
	public void run(){
		Toolkit.getDefaultToolkit().beep();
		timer.cancel();
	}
}
